package com.wordsfairy.filesync.utils.log.print

import com.wordsfairy.filesync.utils.log.LogLevel
import com.wordsfairy.filesync.utils.log.format.BaseFormatStrategy
import com.wordsfairy.filesync.utils.log.print.IPrinter

abstract class BaseLogTxtPrinter: IPrinter {


    override fun print(logLevel: LogLevel, tag: String?, msg: String?, thr: Throwable?, param:Any?) {
        if (!isPrint()) {
            //debugLog("不需要打印到文件")
            return
        }
        if (logLevel.logLevel < getPrintMinLevel().logLevel) {
            //debugLog("日志级别比最低级别小，不需要打印")
            return
        }
        val logBody = getLogcatFormatStrategy().format(logLevel, tag, msg, thr,param) //组装数据
    }

    //释放打印日志
    abstract fun isPrint(): Boolean

    //最小打印级别，比他低级的日志不会打印
    abstract fun getPrintMinLevel(): LogLevel

    //日志输出格式
    abstract fun getLogcatFormatStrategy(): BaseFormatStrategy


}


